<template>
  <div class="search">
    <f-form ref="form" :action="api.shop" :form-key="this.formItem.shopId">
      <f-form-item label="店铺名称" name="shopName" :required="true" :value="formItem.shopName"/>
      <f-form-item label="联系人" name="linkMan" :required="true" :value="formItem.linkMan"/>
      <f-form-item label="联系电话" name="linkTel" :required="true" :value="formItem.linkTel"/>
      <f-form-item label="所属区域" type="other">
        <area-select :proId.sync="formItem.proId" :cityId.sync="formItem.cityId" :areaId.sync="formItem.areaId"  v-if="loaded"></area-select>
      </f-form-item>
      <f-form-item label="店铺地址" name="shopAddress" :required="true" :value="formItem.shopAddress"/>
      <f-form-item label="营业范围" name="businessScope" type="textarea" :value="formItem.businessScope"/>
      <f-form-item label="店铺简介" name="shopDesc" type="editor" :value="formItem"/>
      <f-form-item label="店铺Logo" type="upload" name="shopLogo" v-if="loaded" :value.sync="formItem.shopLogo" :file-max="1"/>
      <f-form-item label="店铺状态" name="shopState" type="radio" data-type="number" :data="api.shop.shopStatus" :value="formItem.shopState"/>
      <f-form-item label="审核意见" name="remark"  :value="formItem.remark"/>
    </f-form>
  </div>
</template>

<script>

  export default {
    name: 'shopForm',
    props: {},
    data () {
      return {
        isAdd: true,
        loaded: false,
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem () {
        return {
          shopName: ''
        }
      },
      setData (data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        this.isAdd = true
        if (data && data.shopId) {
          this.formItem = data
          this.isAdd = false
        }
        this.loaded = true
      },
      handleSubmit () {
        this.$refs.form.submit({ shopLogo: this.formItem.shopLogo, shopDesc: this.formItem.shopDesc, businessScope: this.formItem.businessScope,proId:this.formItem.proId,cityId:this.formItem.cityId,areaId:this.formItem.areaId })
      }
    },
    created () {

    },
    components: {  }
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
